home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / fp / ifp_unix.lzh / ifp / interp / except.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-23  |  2.6 KB  |  76 lines

  1.  
  2. /****** except.c ******************************************************/
  3. /**                                                                  **/
  4. /**                    University of Illinois                        **/
  5. /**                                                                  **/
  6. /**                Department of Computer Science                    **/
  7. /**                                                                  **/
  8. /**   Tool: IFP                         Version: 0.5                 **/
  9. /**                                                                  **/
  10. /**   Author:  Arch D. Robison          Date:   May 1, 1985          **/
  11. /**                                                                  **/
  12. /**   Revised by: Arch D. Robison       Date:   Dec 5, 1985          **/
  13. /**                                                                  **/
  14. /**   Principal Investigators: Prof. R. H. Campbell                  **/
  15. /**                            Prof. W. J. Kubitz                    **/
  16. /**                                                                  **/
  17. /**                                                                  **/
  18. /**------------------------------------------------------------------**/
  19. /**   (C) Copyright 1987  University of Illinois Board of Trustees   **/
  20. /**                       All Rights Reserved.                       **/
  21. /**********************************************************************/
  22.  
  23. /************************* Exception Handlers *************************/
  24.  
  25. #include <stdio.h>
  26. #include "struct.h"
  27. #include "umax.h"
  28.  
  29. #if OPSYS!=CTSS
  30. #include <signal.h>
  31. #endif
  32.  
  33. /*
  34.  * There are currently two exceptions which must be dealt with.
  35.  * 
  36.  *    1.  Interpreter (system) errors, e.g. out of memory
  37.  *        These are indicated by setting the variable 'SysError' to the
  38.  *        appropriate non-zero value.  The values are listed in struct.h
  39.  *
  40.  *    2.  User interrupts, i.e. ctrl-C.
  41.  *          These are counted by the variable SysStop.
  42.  *
  43.  *        0 = process normally
  44.  *        1 = stop processing and print back trace
  45.  *        2 = return to top level without printing back trace
  46.  */
  47. short SysError = 0;     /* An error occurred if SysError != 0 */
  48. short SysStop = 0;
  49.  
  50. #if OPSYS!=CTSS
  51. private void SetStop ()
  52.    { 
  53.       SysStop++; 
  54.       (void) ((*signal) (SIGINT,SetStop));
  55.    }
  56. #endif OPSYS!=CTSS
  57.  
  58. /*
  59.  * ResetExcept
  60.  *
  61.  * Reset exception handling to normal state.
  62.  */
  63. void ResetExcept ()
  64.    {
  65.       extern int UDump();
  66.       SysError = 0;
  67.       SysStop = 0;
  68. #if OPSYS!=CTSS
  69.       (void) signal (SIGINT,SetStop);
  70. #endif
  71. #if OPSYS==DOS
  72.       SetCBrk ();
  73. #endif
  74.    }
  75.  
  76.